
<style type="text/css">
#content{/* width:960px; */ margin-top: 0px;}
#top_header_bar{height:363px;}

#registerDiv{width: 930px; margin:125px auto;}
#registerDiv dl{margin:12.5px 0;}
#registerDiv dt, #registerDiv dd{display:inline-block;}
#registerDiv dt{width:230px; text-align:right;}
#registerDiv dt label{font-size: 37.5px;}
#registerDiv dd{width:690px;}
#registerDiv dd .input-text{width: 450px; height:60px; margin-top:25px; border: 2px solid #ccc;}
#registerDiv dd .input-text-captcha{width: 230px; height:60px; margin-top:25px; border: 2px solid #ccc;}
#registerDiv dd .input-text-captcha-mobile-button{width: 230px; height:60px; margin-top:25px;}
#registerDiv dd .input-submit{width: 454px; height:64px; margin-top:25px; font-size: 37.5px;}
/* #captcha-element img{position:relative; top:10px; border:1px solid #ccc; cursor:pointer;} */
#member_register_captcha_img{position:relative; top:25px; width:200px; height:60px; border:2px solid #ccc; /* margin:1px 0; */ cursor:pointer;}
</style>

<div id="registerDiv">
	<form id="register_form" action="<?php echo $view_data['mobile_do_register_url']; ?>" method="post" onsubmit="return mobile_do_register();">
    	<dl>
            <dt id="mobile-label"><label for="mobile">手机：</label></dt>
            <dd id="mobile-element">
                <input class="input-text" type="text" id="mobile" name="mobile" value="" />
            </dd>
        </dl>

        <dl>
            <dt id="mobile-label"><label for="mobile"></label></dt>
            <dd id="mobile-element">
                如果手机已被其他人注册，请联系客服取回账号
            </dd>
        </dl>

        
        <dl>    
            <dt id="password-label"><label for="password">密码：</label></dt>
            <dd id="password-element">
                <input class="input-text" type="password" id="password" name="password" value="" />
            </dd>
        </dl>
        
        <dl>    
            <dt id="confirm_password-label"><label for="confirm_password">确认密码：</label></dt>
            <dd id="confirm_password-element">
                <input class="input-text" type="password" id="confirm_password" name="confirm_password" value="" />
            </dd>
        </dl>

        <dl>
            <dt id="captcha-input-label"><label class="required" for="captcha-input">验证码：</label></dt>
            <dd id="captcha-element">
                <input id="member_register_captcha" class="input-text-captcha" type="text" name="member_register_captcha" value="" />
                <img id="member_register_captcha_img" src="<?php echo $view_data['register_captcha_url']; ?>" alt="换一张" title="换一张" onclick="refresh_captcha();" />
            </dd>
        </dl>
          
        <dl>    
            <dt id="submit-label">&nbsp;</dt>
            <dd id="submit-element">
                <!-- <input class="input-submit" type="submit" value="注册" name="mobile_do_register_submit" /> -->
                <input class="input-submit" type="submit" value="注册" />

                <div class="form_error_message">
                    <span class="form_error_message_mark">!</span>
                    <span class="form_error_message_content"></span>
                </div>
            </dd>
        </dl>
    </form>

</div>

<script type="text/javascript">
function refresh_captcha(){
	var register_captcha_url = "<?php echo $view_data['register_captcha_url']; ?>" + '&random=' + Math.random();
    $('#member_register_captcha_img').attr('src', register_captcha_url);
}

function mobile_do_register(){
	$.ajax({
		type: 'POST',
		url: "<?php echo $view_data['mobile_do_register_url']; ?>",
		data: $('#register_form').serialize(),
		dataType: 'json',
		success: function(rdata){
			if(rdata.status <= 0){
                refresh_captcha();

				//alert(rdata.message);
                show_form_error_message(rdata.message);
			}else{
				alert(rdata.message); //return false;
                window.top.location.replace('<?php echo $this->get_url(array('route' => 'member_mobile_login')); ?>');
			}	
			
			return false;	
		}
	});
	
	return false;
}

</script>  